package com.czy.test;

import cn.hutool.json.JSONUtil;
import cn.hutool.script.ScriptRuntimeException;
import cn.hutool.script.ScriptUtil;
import com.czy.workflow.core.model.FlowNode;
import com.czy.workflow.core.model.TaskInfo;
import org.junit.Test;

import javax.script.CompiledScript;
import javax.script.ScriptException;

public class Main {


    @Test
    public void test1(){
//        FlowNode node = new FlowNode();
//        node.setId("xxx");
//        node.setName("x");
//        TaskInfo taskInfo = new TaskInfo();
//        taskInfo.setNode(node);
//        String jsObj = JSONUtil.toJsonStr(taskInfo);
//        String exp = "var task = " + jsObj + "; print(JSON.stringify(task.node));";
//        CompiledScript script = ScriptUtil.compile(exp);
//        try {
//            Object result = script.eval();
//            System.out.println(result);
//            System.out.println(result == Boolean.TRUE);
//        } catch (ScriptException e) {
//            throw new ScriptRuntimeException(e);
//        }
        try {
            Object obj = Main.class.getMethod("test2").invoke(new Main());
            Boolean result = (Boolean) obj;
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void test2(){
        return;
    }


}
